<?php
/**
 * 工具类
 * 
 * @author OB<yeyq.yfr@yikuaiqu.com>
 */

class Tool
{
    
    /**
     * 存放日志，主要目的是减少代码
     * 
     * @param string $msg
     * @param string $fileName
     */
    public static function log($msg,$fileName){
         Yii::log($msg,'profile','general.'.$fileName);
    }
    
    public static function rightMessage($data){
		$data=json_encode($data);
		$callback = isset($_REQUEST['callback']) ? $_REQUEST['callback'] : '';
		if(!empty($callback)){
			$data = $callback . '(' . $data . ')';
		}
		echo $data;exit;
	}
	
    public static function errorMessage($content){
		$data['status']=1;
		$data['message']=$content;
		$data=json_encode($data);
		$callback = isset($_REQUEST['callback']) ? $_REQUEST['callback'] : '';
		if(!empty($callback)){
			$data = $callback . '(' . $data . ')';
		}
		echo $data;exit;
	}
}